Skip to content

Add nil check for expected & actual type#22

Merged
gouravkrosx merged 2 commits intokeploy:mainfrom
harshitashankar:nilcheck-comparejson
May 8, 2025
Merged

Add nil check for expected & actual type#22
gouravkrosx merged 2 commits intokeploy:mainfrom
harshitashankar:nilcheck-comparejson

Conversation

@harshitashankar
Copy link
Copy Markdown
Contributor

@harshitashankar harshitashankar commented May 1, 2025

Issue desc

Keploy stopped with nil pointer panic when tests were being replayed
Keploy used from https://github.com/harshitashankar/keploy/tree/main-4may-sync branch (w/o this change in jsondiff)

Error screenshot

Screenshot 2025-05-05 at 3 04 38 PM

This change fixes nil pointer error in jsondiff code. Verified that tests are successfully replayed with this change in jsondiff

@keploy
Copy link
Copy Markdown

keploy Bot commented May 1, 2025

To generate Unit Tests for this PR, please click here

@slayerjain slayerjain requested a review from Copilot May 5, 2025 09:51
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR aims to fix a nil pointer panic in the JSON diff comparison by enhancing error messages and adding an explicit nil check for the JSON type information.

  • Enhanced error reporting for JSON unmarshal failures
  • Introduced a nil check for type information to ensure safe type comparisons

Comment thread jsondiff.go Outdated
@slayerjain
Copy link
Copy Markdown
Member

@harshitashankar can you please check the failing test ?

@harshitashankar
Copy link
Copy Markdown
Contributor Author

@harshitashankar can you please check the failing test ?
Seems to be passing when I run the tests locally. I added one more commit. Can you pls approve workflow again to run tests.

@harshitashankar harshitashankar force-pushed the nilcheck-comparejson branch 3 times, most recently from cb4ec8e to 602959a Compare May 8, 2025 08:59
Signed-off-by: Harshita Shankar <harshitashankar@yahoo.com>
@harshitashankar harshitashankar force-pushed the nilcheck-comparejson branch from 602959a to 7af58de Compare May 8, 2025 09:02
Signed-off-by: Harshita Shankar <harshitashankar@yahoo.com>
Copy link
Copy Markdown
Member

@gouravkrosx gouravkrosx left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@gouravkrosx gouravkrosx merged commit 117b584 into keploy:main May 8, 2025
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants